#include "functions.h"

void offspring(){
  int i, j;
  int num;
  double new_point;

  for( i=0; i<population_size; i++ )
    {
      for( j=0; j<number_of_dimensions; j++ )
	{
	  num = 0;
	  do{
	    num++;
	    new_point = gaussrand( center[ j ], sigma[ j ] );
	  // new_point = get_random_double_value( center[ j ] - sigma[ j ], center[ j ] + sigma[ j ] );

	    if( num > 100 ){
	      if( 0.5 > get_random_double_value( 0, 1 ) ){

		new_point = lower_limit;

	      } else{

		new_point = upper_limit;

	      }
	    }

	  }while(new_point < lower_limit || new_point > upper_limit);

	  individuals[ i ].design_variables[ j ] = new_point;

	} // end of number_of_dimensions

      individuals[ i ].function_value = evaluate( individuals[ i ].design_variables );
	  
    }
}

